package com.ls.mq.thread;

import java.util.concurrent.Callable;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.Future;

public class ExecutorsManager {

	public static ExecutorsManager instance = new ExecutorsManager();
	private ExecutorService threadPool;
	private ExecutorsManager() {
		threadPool =	Executors.newCachedThreadPool(new NamedThreadFactory("MqThread"));
	};
	public static ExecutorsManager getInstance() {
		return instance;
	}
	
	public Future<?> submit(Runnable task){
		return threadPool.submit(task);
	}
	
	public <V> Future<V> submit(Callable<V> task){
		return threadPool.submit(task);
	}
	
	
	
	
}
